package net.xiangcaowuyu.simplemybatis.config;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * datasource配置文件
 * @author laughing
 * @date 2020/9/30
 * @site https://www.xiangcaowuyu.net
 */
@Configuration
public class DataSourceConfig {

    /**
     *
     * @return 第一个数据源
     */
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.mybatisone")
    DataSource dataSourceOne(){
        return DruidDataSourceBuilder.create().build();
    }

    /**
     *
     * @return 第二个数据源
     */
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.mybatistwo")
    DataSource dataSourceTwo(){
        return DruidDataSourceBuilder.create().build();
    }

}
